package study06;

class BankAccount{
    int account_number;//账号
    double leftmoney;//存款余额
    public double getleftmoney () {//查询余额
        return leftmoney;
    }
    public void savemoney(double money) {//存款
        leftmoney+=money;
    }
    public void getmoney (double money){//取款
        leftmoney-=money;
    }
    public BankAccount (int number, double money){ //构造方法，用来初始化变量account_number=number;
        leftmoney=money;
    }
}
public class Example05 {

    /**
    * @author GZQ
    * @Date 2023/11/30
     */
    public static void main(String[] args) {
        BankAccount ba=new BankAccount(123456,600);
        ba.savemoney(2000);
        System.out.println("存入 2000 元后，您的余额为："+ba.getleftmoney());ba.getmoney(1000);
        System.out.println("取款 1000 元后，您的余额为："+ba.getleftmoney());}
}